package com.woniuxy.oldmanapi.mapper;

import com.woniuxy.oldmanapi.entity.CheckIn;
import com.woniuxy.oldmanapi.xvo.OlderVo;
import com.woniuxy.oldmanapi.zvo.CheckInVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.Date;
import java.util.List;

@Repository
public interface CheckInMapper extends Mapper<CheckIn> {
    @Update("update `check-in` set status=0 where id=#{id}")
    void cancelCheckIn(int id);

    List<CheckInVo> selectCons(@Param("name") String name,@Param("beginDate") Date beginDate, @Param("endDate") Date endDate,
                               @Param("status") int status);

    CheckInVo selectCheckInById(int id);

    OlderVo selectRoomPayById(int id);

    OlderVo selectCarePayById(int id);
    @Insert("insert into `check-in` (older_id,beginDate,endDate,totalPrice,status,description,ICCard) " +
            "values(#{olderId},#{begindate},#{enddate},#{totalprice},#{status}," +
            "#{description},#{ICCard})")
    void insertTo(CheckIn checkIn);
}